//slave - Rainbowduino
 
#include <Wire.h>
#include <Rainbowduino.h>
 
int c,x,y,r,g,b;
 
void setup(){
    Rb.init();
    
    //tuto adresu musime nastavit zvlast pro kazdou desku
    Wire.begin(100); 
    
    Wire.onReceive(priPrijmu);
}
 
void loop(){

}    
 
void priPrijmu(int c){
    while(Wire.available() > 0){
        c = Wire.read();
        x = Wire.read();
        y = Wire.read();
        r = Wire.read();
        g = Wire.read();
        b = Wire.read();
    }
    if(c == 1){
        Rb.blankDisplay();
    }
    if(x < 8 && y < 8){
        Rb.setPixelXY(x,y,r,g,b); 
    }
}